package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sun.org.apache.bcel.internal.generic.ReturnaddressType;
import lombok.Getter;
import lombok.Setter;
import sun.java2d.pipe.SpanShapeRenderer;

import java.text.SimpleDateFormat;
import java.util.Date;
@Getter
@Setter
public class ChatMessage extends BaseDomain {
    //发送者
    private User sender;
    //接受者
    private User receiver;
    //发送内容
    private String content;
    //消息读取状态
    private boolean status;
    //发送时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date sendTime;

    public String getTimeString(){
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        return sdf.format(sendTime);
    }

}